//
//  NSString+XXNSStringExt.m
//  QQ聊天
//
//  Created by 宋 on 16/3/14.
//  Copyright © 2016年 宋. All rights reserved.
//

#import "NSString+XXNSStringExt.h"

@implementation NSString (XXNSStringExt)

-(CGSize)sizeOfTextWithMaxSize:(CGSize)maxSize font:(UIFont*)font{
    NSDictionary* attrs = @{NSFontAttributeName:font};
    
    return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
}

+(CGSize)sizeWithText:(NSString*)text maxSize:(CGSize)maxSize font:(UIFont*)font{
     return [text sizeOfTextWithMaxSize:maxSize font:font];
}

@end
